<template>
  <div @click="clickHandle">

    <p>我的书屋</p>
    <div v-for="book in books" :key="book">
      {{book.title}}
    </div>
  </div>
</template>

<script>
  // 先获取数据库的引用
  const db = wx.cloud.database();
  export default {
    data() {
      return {
        books: []
      }
    },
    methods: {
      async getBooks() {
        console.log('打印数据')
        const bookInfo = await db.collection('yggBook').get();
        this.books = bookInfo.data;
        console.log(bookInfo.data)

      }

    },
    created() {
      this.getBooks()
    }
  }
</script>

<style>

</style>
